
<!DOCTYPE html>
<html style="overflow-x:hidden;overflow-y:auto;">
	<head>
		<title>角色管理</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		[#include "/admin/include/header.htm"]
		<link href="${base}/static/plugin/jquery-ztree/3.5.12/css/zTreeStyle/zTreeStyle.min.css" rel="stylesheet" type="text/css"/>
		<script src="${base}/static/plugin/jquery-ztree/3.5.12/js/jquery.ztree.core-3.5.min.js" type="text/javascript"></script>
		<script src="${base}/static/plugin/jquery-ztree/3.5.12/js/jquery.ztree.excheck-3.5.min.js" type="text/javascript"></script>
		<script type="text/javascript">
		$(document).ready(function(){
			$("#name").focus();
			$("#inputForm").validate({
				rules: {
					roleName: {remote: "/admin/role/checkRoleName?oldRoleName=" + encodeURIComponent("${sysRole.roleName!}")}
				},
				messages: {
					roleName: {remote: "角色名已存在"}
				},
				submitHandler: function(form){
					var ids = [], nodes = tree.getCheckedNodes(true);
					for(var i=0; i<nodes.length; i++) {
						ids.push(nodes[i].id);
					}
					$("#menuIds").val(ids);
					var ids2 = [], nodes2 = tree2.getCheckedNodes(true);
					for(var i=0; i<nodes2.length; i++) {
						ids2.push(nodes2[i].id);
					}
					loading('正在提交，请稍等...');
					form.submit();
				}
			});

			var setting = {
				check:{enable:true,nocheckInherit:true},
				view:{selectedMulti:false},
				data:{
					simpleData:{enable:true}
				},
				callback:{
					beforeClick:function(id, node){
						tree.checkNode(node, !node.checked, true, true);
						return false;
					}
				}
			};
			// 用户-菜单
			var zNodes=[
							[#if allMenuList as m]
				              	[#if m_index==0]
				          			{ id : "${m.menuId}", pId : "${m.pid!'0'}", name : "${m.menuName!}" }
				              	[#else]
				              		, { id : "${m.menuId}", pId : "${m.pid!'0'}", name : "${m.menuName!}" }
				              	[/#if]
				            [/#if]
	            ];
			// 初始化树结构
			var tree = $.fn.zTree.init($("#menuTree"), setting, zNodes);
			// 默认选择节点
			var ids = "${checkMenuIds}".split(","); 
			for(var i=0; i<ids.length; i++) {
				var node = tree.getNodeByParam("id", ids[i]);
				try{tree.checkNode(node, true, false);}catch(e){}
			}
			// 默认展开全部节点
			tree.expandAll(true);
		});
	</script>

	</head>
	<body>
		
	<ul class="nav nav-tabs">
		<li><a href="/admin/role/list">角色列表</a></li>
		<li class="active"><a href="javascript:;">角色修改</a></li>
	</ul><br/>
	
	<form id="inputForm" class="form-horizontal" action="update" method="post">
		<input id="id" name="id" type="hidden" value="6"/>
<script type="text/javascript">top.$.jBox.closeTip();</script>		<div class="control-group">
			<label class="control-label"><span style="color:red;">*</span>角色名称:</label>
			<div class="controls">
				<input id="name" name="name" class="required" type="text" value="非撮合交易员" minlength="2" maxlength="50"/>
				<span class="help-inline">角色名称建议语义明确</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="roleTag">角色标签:</label>
			<div class="controls">
				<select id="roleTag" name="roleTag">
						<option value="CUSTOMER" >客服员</option>
						<option value="TRANZ" >交易员</option>
						<option value="OTHER"  selected="selected" >其它</option>
						<option value="MFPLASTIC_TRANZ" >改性交易员</option>
						<option value="MERCHANDISER" >跟单员</option>
						<option value="PURCHASE" >采购员</option>
						<option value="FINANCE" >财务员</option>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">数据范围:</label>
			<div class="controls">
				<select id="dataScope" name="dataScope">
						<option value="DATA_NONE" >不设置</option>
						<option value="DATA_SCOPE_ALL" selected="selected">所有数据</option>
						<option value="DATA_SCOPE_COMPANY_AND_CHILD" >所在公司(部门)及以下数据</option>
						<option value="DATA_SCOPE_COMPANY" >所在公司(部门)数据</option>
						<option value="DATA_SCOPE_SELF" >仅本人数据</option>
				</select>
				<!-- <span class="help-inline">特殊情况下，设置为“按明细设置”，可进行跨机构授权</span> -->
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">角色授权:</label>
			<div class="controls">
				<div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div>
				<input id="menuIds" name="menuIds" type="hidden" value="1,2,4,5,6,7,8,9,10,11,12,15,16,17,18,28,29,30,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,49,68,95,96,97,106,115,116,117,120,121,122,125,126,127,128,132,135,149,150,151,152,153,154,200"/>
				<div id="orgTree" class="ztree" style="margin-left:100px;margin-top:3px;float:left;"></div>
				<input id="orgIds" name="orgIds" type="hidden" value=""/>
			</div>
		</div>
		<div class="form-actions">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
				<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form>

	</body>
</html>